<template>
    <div v-if="isLoad">
        <listText :title="'合作企业'" :itemVal="infoSource.name"></listText>
        <listText :title="'联系方式'" :itemVal="infoSource.mobile"></listText>
        <listText :title="'通讯地址'"
                  :itemVal="infoSource.province +infoSource.city+infoSource.area+infoSource.address"></listText>
        <listText :title="'所属行业'" :itemVal="infoSource.industry_name"></listText>
        <listText :title="'客户类型'" :itemVal="infoSource.cooperation_name"></listText>
        <listText :title="'业务员'" :itemVal="infoSource.salesman_text"></listText>
        <listText :title="'特殊备注'" :itemVal="infoSource.remark"></listText>
        <listText :title="'合作机会'" :itemVal="infoSource.cooperation"></listText>
        <div class="link-btn">
            <router-link  v-if="button1" tag="div" to="/csEditor">信息编辑</router-link>
            <router-link  v-if="button2" tag="div" to="/csAllocationPeople">分配负责人</router-link>
            <router-link  v-if="button3" tag="div" to="/csProdectConfig">产品配置</router-link>
            <router-link  v-if="button4"tag="div" to="/csConfigHistory" >产品配置记录</router-link>
        </div>
    </div>
</template>

<script>
    import listText from '@/components/listText.vue'

    export default {
        name: "finance",
        components: {listText},
        data() {
            return {
                infoSource: {},
                isLoad: false,
                button1: false,     // 信息编辑
                button2: false,     // 分配负责人
                button3: false,     // 产品配置
                button4: false,     // 产品配置记录
            }
        },
        methods: {
            getInfo() {
                let params = {
                    wx_member_id: localStorage.getItem('wx_member_id'),
                    token: localStorage.getItem('token'),
                    cate_id: 3,
                };
                this.$post("/api/member/read", params)
                    .then(res => {
                        if (res.code == 1) {
                            this.infoSource = res.data
                            this.isLoad = true
                        } else {
                            this.$Toast(res.msg);
                        }
                    })
                    .catch(err => {
                    });
            },
        },
        created() {
            this.getInfo()
            this.button1 = this.$queryMenu('Business/edit_info');       //客户信息编辑
            this.button2 = this.$queryMenu('Business/product_deal');    //产品配置
            this.button3 = this.$queryMenu('Business/leader');          //分配负责人
            this.button4 = this.$queryMenu('Business/product_log');     //产品配置记录
        }
    }
</script>

<style lang="less" scoped>
    .link-btn {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;

        div {
            width: 45vw;
            height: 34px;
            border-radius: 4px;
            background: #366cb3;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #fff;
            margin: 4px;
            font-size: 12px;
        }
    }
</style>